Introduction¶

Over 3.5 billion searches are performed on Google every day — that"s more than 40,000 searches per second. With such a massive volume of queries, Google Search data becomes a valuable source for understanding public interest, behavior, and emerging trends.

While Google doesn’t provide direct access to individual search data, its platform Google Trends offers a way to analyze aggregated search patterns. Using the Pytrends Python library (a lightweight unofficial API for Google Trends), we can extract search interest data for specific keywords across time and geography.

In this project, I analyze trends for three high-demand tech topics: Data Analytics, Cloud Computing, and Machine Learning.

🔍 Goals of the Project¶

  • Analyze search interest across different countries

  • Explore time-based interest trends

  • Compare the popularity of related keywords

  • Derive insights that can help in decision-making for businesses, educators, and learners

  • To install Pytrends:

pip install Pytrends

In [2]:
pip install pytrends matplotlib pandas seaborn plotly
Requirement already satisfied: pytrends in d:\users\admin\anaconda3\lib\site-packages (4.9.2)
Requirement already satisfied: matplotlib in d:\users\admin\anaconda3\lib\site-packages (3.9.2)
Requirement already satisfied: pandas in d:\users\admin\anaconda3\lib\site-packages (2.2.2)
Requirement already satisfied: seaborn in d:\users\admin\anaconda3\lib\site-packages (0.13.2)
Requirement already satisfied: plotly in d:\users\admin\anaconda3\lib\site-packages (5.24.1)
Requirement already satisfied: requests>=2.0 in d:\users\admin\anaconda3\lib\site-packages (from pytrends) (2.32.3)
Requirement already satisfied: lxml in d:\users\admin\anaconda3\lib\site-packages (from pytrends) (5.2.1)
Requirement already satisfied: contourpy>=1.0.1 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (1.2.0)
Requirement already satisfied: cycler>=0.10 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (4.51.0)
Requirement already satisfied: kiwisolver>=1.3.1 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (1.4.4)
Requirement already satisfied: numpy>=1.23 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (1.26.4)
Requirement already satisfied: packaging>=20.0 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (24.1)
Requirement already satisfied: pillow>=8 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (10.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in d:\users\admin\anaconda3\lib\site-packages (from matplotlib) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in d:\users\admin\anaconda3\lib\site-packages (from pandas) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in d:\users\admin\anaconda3\lib\site-packages (from pandas) (2023.3)
Requirement already satisfied: tenacity>=6.2.0 in d:\users\admin\anaconda3\lib\site-packages (from plotly) (8.2.3)
Requirement already satisfied: six>=1.5 in d:\users\admin\anaconda3\lib\site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
Requirement already satisfied: charset-normalizer<4,>=2 in d:\users\admin\anaconda3\lib\site-packages (from requests>=2.0->pytrends) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in d:\users\admin\anaconda3\lib\site-packages (from requests>=2.0->pytrends) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\users\admin\anaconda3\lib\site-packages (from requests>=2.0->pytrends) (2.2.3)
Requirement already satisfied: certifi>=2017.4.17 in d:\users\admin\anaconda3\lib\site-packages (from requests>=2.0->pytrends) (2025.4.26)
Note: you may need to restart the kernel to use updated packages.
In [3]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
from pytrends.request import TrendReq

setup pytrend library and keyword define¶

In [4]:
pytrends =TrendReq(hl='en-US', tz=360)
keyword = "Data Analytics"

Data Request¶

In [5]:
pytrends.build_payload([keyword], cat =0,timeframe ='today 12-m', geo='', gprop = '')

Country wise interest¶

In [6]:
region_data = pytrends.interest_by_region()
region_data = region_data.sort_values(by = keyword,ascending = False).head(15)
In [7]:
plt.figure(figsize = (10,6))
sns.barplot(x =region_data[keyword], y = region_data.index, palette = "Blues_d")
plt.title(f"Top Countries for'{keyword}'")
plt.xlabel("Interest")
plt.ylabel("Country")
plt.show()
C:\Users\ADMIN\AppData\Local\Temp\ipykernel_10096\3642021073.py:2: FutureWarning: 

Passing `palette` without assigning `hue` is deprecated and will be removed in v0.14.0. Assign the `y` variable to `hue` and set `legend=False` for the same effect.

  sns.barplot(x =region_data[keyword], y = region_data.index, palette = "Blues_d")
No description has been provided for this image

World map¶

In [8]:
region_data =region_data.reset_index()
fig = px.choropleth(region_data,
                    locations='geoName',
                    locationmode='country names',
                    color=keyword,
                    title=f"search Interest for '{keyword}' by Country",
                    color_continuous_scale='Blues')
fig.show()

Time wise interest¶

In [11]:
time_df = pytrends.interest_over_time()
D:\Users\ADMIN\Anaconda3\Lib\site-packages\pytrends\request.py:260: FutureWarning:

Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`

In [12]:
plt.figure(figsize=(12,6))
plt.plot(time_df.index,time_df[keyword], marker ='o', color = 'purple')
plt.title(f"search interest over time '{keyword}' ")
plt.xlabel("Date")
plt.ylabel("Interest")
plt.grid(True)
plt.show()
No description has been provided for this image

Multiple keywords compare¶

In [13]:
kw_list = ["cloud computing", "data analytics", "machine learning"]
pytrends.build_payload(kw_list, cat=0, timeframe='today 12-m', geo ='', gprop='')
In [14]:
compare_df = pytrends.interest_over_time()
plt.figure(figsize=(12,6))
for kw in kw_list:
    plt.plot(compare_df.index,compare_df[kw], label = kw)

plt.title("keyword compare over time")
plt.xlabel("Date")
plt.ylabel("Interest")
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
D:\Users\ADMIN\Anaconda3\Lib\site-packages\pytrends\request.py:260: FutureWarning:

Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`

No description has been provided for this image

✅ Conclusion¶

In June 2025, we can observe a significant surge in Google searches related to “Machine Learning”, highlighting its growing relevance and demand in the tech industry. This analysis demonstrates how Google Trends data can provide valuable insights into public interest over time.

By using keyword-based trend analysis, we can understand:

  • What people are searching for

  • When interest spikes

  • Where the demand is highest

💼 Real-World Application:

Businesses, educators, and decision-makers can use such search analysis to:

  • Spot upcoming trends

  • Align marketing or product strategies

  • Design relevant learning programs

  • Understand consumer behavior in real-time

This project proves that even a simple keyword analysis with tools like Pytrends can reveal powerful patterns that support smarter, data-driven decisions.

In [ ]: